#include<bits/stdc++.h>
using namespace std;
int a[100005],n,jsh[100005];
bool isf[100005];
void solve(){
    int dqx=1;
    for(int i=1;i<=n;i++){
        if(jsh[a[dqx]]%2==1) jsh[a[dqx]]++;
        jsh[a[dqx]]=jsh[a[dqx]]/2;
        for(int i=1;i<=n;i++){
            if(a[i]==a[dqx])
                isf[i]=true;
            else
                break;
        }
        int fdx=dqx;
        for(int j=dqx;j<=n;j++){
            if(a[j]!=a[dqx]){
                dqx=j;
                break;
            }
        }
        if(dqx==fdx){
            return;
        }
        if(isf[dqx]==false&&jsh[a[fdx]]>=1){
            isf[dqx]=true;
            jsh[a[fdx]]--;
        }
    }
    return;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    memset(isf,false,sizeof isf);
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int x;
        scanf("%d",&x);
        a[i]=x;
        jsh[x]++;
    }
    sort(a+1,a+n+1);
    solve();
    long long ans=jsh[a[1]];
    int dqx=jsh[a[1]];
    for(int i=1;i<=n;i++){
        if(jsh[a[i]]!=dqx){
            dqx=jsh[a[i]];
            ans+=jsh[a[i]];
        }
    }
    printf("%lld\n",ans);
    return 0;
}
